package Exercise;

/**
 * @author 王艺锡
 * @version 1.0
 */
public class Exercise07 {
    public static void main(String[] args) {
        Color green = Color.RED;
        green.show();
        switch (green){
            case GREEN :
                System.out.println("匹配到绿色");
                Color.GREEN.show();
                break;
            case RED:
                System.out.println("匹配到红色");
                Color.RED.show();
                break;
            default:
                System.out.println("匹配失败");
                break;
        }
    }
}

interface Icolor{
    public void show();
}

enum Color implements Icolor{
    RED(255,0,0),
    BLUE(0,0,255),
    BLACK(0,0,0),
    YELLOW(255,255,0),
    GREEN(0,255,0);

    private int redValue;
    private int greenValue;
    private int blueValue;

    Color(int redValue, int greenValue, int blueValue) {
        this.redValue = redValue;
        this.greenValue = greenValue;
        this.blueValue = blueValue;
    }


    @Override
    public void show() {
        System.out.println("redValue:" + redValue + " greenValue:" + greenValue +
                " blueValue" + blueValue);
    }
}
